package my.test.bean.ex14.config;

import org.springframework.jdbc.core.JdbcTemplate;

public class ProductDao {
	
   JdbcTemplate jdbcTemplate;

   public JdbcTemplate getJdbcTemplate() {
	  return jdbcTemplate;
   }
   
   public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
	  this.jdbcTemplate = jdbcTemplate;
   }

   /**
    * 更新库存
    * @param goodsId
    */
   public void updateStock(String goodsId) {
	  String sql = "update product_stock set stock=stock-1 where goods_id=?"; 
	  jdbcTemplate.update(sql,goodsId);
   }

}
